import {dataPostRequest, dataPutRequest, deleteRequest, getRequest} from "@/utils/request";

/**
 * 获取角色列表
 * @returns {AxiosPromise}
 */
export const getRoleList = () => {
    return getRequest('/role/list');
};

/**
 * 查询角色信息
 * @param params
 * @returns {AxiosPromise}
 */
export const searchRoleByCondition = (params) => {
    return getRequest("/role/search", params)
}

/**
 * 添加角色信息
 * @param data 角色信息
 * @returns {AxiosPromise}
 */
export const addRole = (data) => {
    return dataPostRequest("/role/add", data)
}

/**
 * 添加角色信息
 * @param data 角色信息
 * @returns {AxiosPromise}
 */
export const updateRole = (data) => {
    return dataPutRequest("/role/update", data)
}

export const deleteRole = (id) => {
    return deleteRequest("/role/delete/" + id)
}
/**
 * 传递版title
 * @returns {string[]}
 */
export const transferTitles = () => {
    return ['显示', '隐藏'];
}
/**
 * 标识
 * @returns {[{value: number, key: string}, {value: number, key: string}, {value: number, key: string}, {value: number, key: string}, {value: number, key: string}, null]}
 */
export const transferRoleData = () => {
    return [
        {
            key: '角色Id',
            value: 1
        },
        {
            key: "角色名称",
            value: 2
        },
        {
            key: "角色标识",
            value: 3
        },
        {
            key: "角色状态",
            value: 4
        },
        {
            key: "角色排序",
            value: 5
        },
        {
            key: "是否删除",
            value: 6
        },
    ];
}